package com.guigusuqi.user.controller;

import com.guigusuqi.commonutils.utils.RedisCache;
import com.guigusuqi.commonutils.vo.Result;
import com.guigusuqi.user.dto.UserLoginDTO;
import com.guigusuqi.user.entity.SysUser;
import com.guigusuqi.user.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@RequestMapping("/user")
@Api(tags = {"登录模块"})
public class UserLoginController
{
    @Resource
    private SysUserService sysUserService;


    @PostMapping("/login")
    @ApiOperation("登录")
    @Transactional
    public Result login(@RequestBody UserLoginDTO userLoginDTO)
    {
        return sysUserService.login(userLoginDTO);
    }

    @PostMapping("/logout")
    @ApiOperation("退出登录")
    public Result logout()
    {
        return sysUserService.logout();
    }

}
